const mongoose = require('mongoose');
const { Schema } = mongoose;

const questionSourceSchema = new Schema({
  sourceType: {
    type: String,
    required: true
  },
  sourceContent: {
    type: String,
    required: true
  }
}, {
  timestamps: true,
  // 配置JSON序列化
  toJSON: {
    virtuals: true,
    transform: function(doc, ret) {
      delete ret._id; // 因为他会默认给出一个id，不需要_id了
      delete ret.__v;
      return ret;
    }
  }
});

const questionSource = mongoose.model('questionSource', questionSourceSchema);

module.exports = questionSource;